﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucMainNav.ascx.cs" Inherits="Module_ucMainNav" %>
<%@ Import Namespace="BLL" %>
<script runat="server">
  MenuBLL menuData = new MenuBLL();
  </script>
    <!--  ==========  -->
    <!--  = Main Menu / navbar =  -->
    <!--  ==========  -->
    <div class="navbar navbar-static-top" id="stickyNavbar">
      <div class="navbar-inner">
        <div class="container">
          <div class="row">
            <div class="span9">
                <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                </button>
                
                <!--  ==========  -->
                <!--  = Menu =  -->
                <!--  ==========  -->
                <div class="nav-collapse collapse">
                <%
      var listTop = menuData.GetByPositionAndLevel(1, 1);
                    
      if (listTop.Count > 0)
      {
       %>
        <ul class="nav" id="mainNavigation">
           <%
          int i = 1;
          foreach (var item in listTop)
          {
            string name_menu = item.Name;
            string url_menu = item.Link;
            switch (item.Mode)
            {
              case 1:
                {
                  //url_menu = Myfunction.GenarateUrlHome("trang-chu");
                    url_menu = "";
                  break;
                }
              case 2:
                {
                  url_menu = Myfunction.GenarateUrlNews(item.Link, prefix_new, name_menu);
                  break;
                }
              case 3:
                {
                  url_menu = Myfunction.GenarateUrlNewsCate(item.Link, "1", prefix_new, name_menu);
                  break;
                }
              case 4:
                {
                    url_menu = Myfunction.GenarateUrlCateProd(prefix_product, name_menu, item.Link);
                  break;
                }
              case 5:
                {
                  //url_menu = Myfunction.GenarateUrlHome("lien-he");
                    url_menu = Myfunction.GenarateUrlHome("lien-he"); ;
                  break;
                }
              case 7:
                {
                    url_menu = Myfunction.GenarateUrlArticle(item.Link, prefix_new, name_menu);
                  break;
                }
              case 6:
                {
                    url_menu = Myfunction.GenarateUrlHome(item.Link); ;
                  break;
                }
              default:
                {
                  break;
                }
            }
            if ("/CMS_V3/"+url_menu == activeLink)
            {
                liClass = "active";
            }
            var listChild = menuData.GetByParent(item.Id, true);
            if (listChild.Count > 0)
            {
            %>
				
					  <li class="dropdown"><a class="active" href="/<%=url_menu %>" class="dropdown-toggle"><%=name_menu%><b class="caret"></b></a>
                           
          
                <%
}
            else
            {

             %>
				
					  <li><a class="active" href="/<%=url_menu %>"><%=name_menu%></a>
                           
          
                <%
            }
                  
                if (listChild.Count > 0)
                { 
                  %>
                  <ul class="dropdown-menu">
                     <%
                    foreach (var itemChild in listChild)
                    {
                      string name_Child = itemChild.Name;
                      string url_Child = itemChild.Link;
                      switch (itemChild.Mode)
                      {
                        case 1:
                          {
                            url_Child = Myfunction.GenarateUrlHome("trang-chu");
                            break;
                          }
                        case 2:
                          {
                            url_Child = Myfunction.GenarateUrlNews(itemChild.Link, prefix_new, name_Child);
                            break;
                          }
                        case 3:
                          {
                            url_Child = Myfunction.GenarateUrlNewsCate(itemChild.Link, "1", prefix_new, name_Child);
                            break;
                          }
                        case 4:
                          {
                              url_Child = Myfunction.GenarateUrlCateProd(prefix_product, itemChild.Name, itemChild.Link);
                            break;
                          }
                        case 5:
                          {
                            url_Child = Myfunction.GenarateUrlHome("lien-he");
                            break;
                          }
                        case 7:
                          {
                              url_Child = Myfunction.GenarateUrlArticle(itemChild.Link, prefix_new, name_Child);
                            break;
                          }
                        case 6:
                          {
                            url_Child = "/" + url_Child;
                            break;
                          }
                        default:
                          {
                            break;
                          }
                      }
                      %>
                     <li><a href="/<%=url_Child %>"><%=name_Child%></a></li>
                      <%
                    }
                      %>
            </ul>
                  <%
              }
                   %>
              </li>
         <%
           i++;
          }
         %>
        </ul>
        <%
      }
         %>

                </div><!-- /.nav-collapse -->
            </div>
            
            <!--  ==========  -->
            <!--  = Cart =  -->
            <!--  ==========  -->
            <div class="span3">
                <div class="cart-container" id="cartContainer">
                    <div class="cart">
                        <p class="items">GIỎ HÀNG <span class="dark-clr">(<asp:Literal ID="ltTotalProduct" runat="server" />)</span></p>
                        <p class="dark-clr hidden-tablet"><asp:Literal ID="ltTotalCost" runat="server" /></p>
                        <a href="/checkout-step-1.aspx" class="btn btn-danger">
                            <!-- <span class="icon icons-cart"></span> -->
                            <i class="icon-shopping-cart"></i>
                        </a>
                    </div>
                    
                        
                       
                    <div class="open-panel">
                    <asp:Repeater ID="rptListCart" runat="server" 
                            onitemdatabound="rptListCart_ItemDataBound">
                        <ItemTemplate>
                        <div class="item-in-cart clearfix">
                            <div class="image">
                                <img src='/Images/Product/big/<%#Eval("Image") %>' width="124" height="124" alt="cart item" />
                            </div>
                            <div class="desc">
                                <strong><a href='/san-pham/<%#Eval("Name") %>/<%#Eval("Id") %>'><%#Eval("Name") %></a></strong>
                                <span class="light-clr qty">
                                    <%#Eval("Id") %> | Số lượng: <%#Eval("Quantity").ToString()%> | Size: <asp:Literal ID="ltSize" Text='<%#Eval("Size").ToString()%>' runat="server" /> | Màu: <asp:Literal ID="ltColor" Text='<%#Eval("Colour").ToString()%>' runat="server" />
                                    &nbsp;
                                    <a href="#" class="icon-remove-sign" title="Remove Item"></a>
                                </span>
                            </div>
                            <div class="price">
                                <strong><%#String.Format("$ {0:0,0}", ((MyShopCart)Session["shop"]).GetCostQty(Eval("Id").ToString(), Convert.ToInt32(Eval("Size")), Convert.ToInt32(Eval("Colour"))))%></strong>
                            </div>
                        </div>
                         
                         </ItemTemplate>
                    </asp:Repeater>
                        <div class="summary">	
                            <div class="line">
                                <div class="row-fluid">
                                    <div class="span6">Tạm tính:</div>
                                    <div class="span6 align-right size-16"><asp:Literal ID="Literal1" runat="server" /></div>
                                </div>
                            </div>
                        </div>
                        <div class="proceed">
                            <a href="checkout-step-1.html" class="btn btn-danger pull-right bold higher">THANH TOÁN <i class="icon-shopping-cart"></i></a>
                            <small>* Giá sản phẩm có thể thay đổi tùy theo giá trên website đặt hàng.</small>
                        </div>
                    </div>

                     
                </div>
            </div> <!-- /cart -->
		</div>
    </div>
</div>
</div> <!-- /main menu -->